<template>
  <div>
    <Table :columns="columns" :data="data"></Table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      columns: [
        {
          title: "类别",
          key: "type",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.type,
              },
              on: {
                "on-change": (e) => {
                  row.type = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "中文名",
          key: "name",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.name,
              },
              on: {
                "on-change": (e) => {
                  row.name = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "英文名",
          key: "enName",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.enName,
              },
              on: {
                "on-change": (e) => {
                  row.enName = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "CAS编号",
          key: "CAS",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.CAS,
              },
              on: {
                "on-change": (e) => {
                  row.CAS = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "H'",
          key: "H",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.H,
                type:"number"
              },
              on: {
                "on-change": (e) => {
                  row.H = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "Da(平方厘米/秒)",
          key: "D_a",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.D_a,
                type:"number"
              },
              on: {
                "on-change": (e) => {
                  row.D_a = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "Dw（平方厘米/秒）",
          key: "D_w",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.D_w,
                type:"number"
              },
              on: {
                "on-change": (e) => {
                  row.D_w = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "Koc（立方厘米/克）",
          key: "K_oc",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.K_oc,
                type:"number"
              },
              on: {
                "on-change": (e) => {
                  row.K_oc = e.target.value;
                },
              },
            });
          },
        },
        {
          title: "S（毫克/升）",
          key: "S",
          render: (h, params) => {
            let row = params.row;
            return h("Input", {
              props: {
                value: row.S,
                type:"number"
              },
              on: {
                "on-change": (e) => {
                  row.S = e.target.value;
                },
              },
            });
          },
        }
      ],
      data: [
        {
          type: "金属及无机物",
          name: "锑",
          enName:"Antimony",
          CAS:"7440-36-0",
          H:0.001,
          D_a:0.001,
          D_w:0.001,
          K_oc:0.001,
          S:0.001
        },
         {
          type: "金属及无机物",
          name: "砷(无机)",
          enName:"Arsenic, inorganic",
          CAS:"7440-36-0",
          H:0.001,
          D_a:0.001,
          D_w:0.001,
          K_oc:0.001,
          S:0.001
        },
        {
          type: "挥发性有机物",
          name: "丙酮",
          enName:"Acetone",
          CAS:"67-64-1",
          H:0.001,
          D_a:0.001,
          D_w:0.001,
          K_oc:0.001,
          S:0.001
        },
         {
          type: "金属及无机物",
          name: "砷(无机)",
          enName:"Benzene",
          CAS:"7440-36-0",
          H:0.001,
          D_a:0.001,
          D_w:0.001,
          K_oc:0.001,
          S:0.001
        }
      ],
    };
  },
};
</script>